﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MDI多文档处理
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void menuItem3_Click(object sender, EventArgs e)
        {
            foreach (Form cform in this.MdiChildren)
            {
                if(cform.Name== "Form2")
                {
                    cform.Visible = true;
                    cform.Activate();
                    return;
                }
            }
            Form2 Mdichild = new Form2();
           
            Mdichild.MdiParent = this;
            Mdichild.Show();
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void menuItem4_Click(object sender, EventArgs e)
        {
            Form3 Mdichild = new Form3();
            Mdichild.MdiParent = this;
            Mdichild.Show();
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void menuItem5_Click(object sender, EventArgs e)
        {
            Form4 Mdichild = new Form4();
            Mdichild.MdiParent = this;
            Mdichild.Show();
            LayoutMdi(MdiLayout.TileHorizontal);
        }
    }
}
